<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GrPPI: stream_reduce.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.svg"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">GrPPI
   &#160;<span id="projectnumber">0.2</span>
   </div>
   <div id="projectbrief">Generic and Reusable Parallel Pattern Interface</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_2bf6146106b191d8ff3cfe67c1b10657.html">poly</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">poly/stream_reduce.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="poly_2stream__reduce_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="preprocessor">#ifndef GRPPI_POLY_STREAM_REDUCE_H</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="preprocessor">#define GRPPI_POLY_STREAM_REDUCE_H</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="polymorphic__execution_8h.html">polymorphic_execution.h</a>&quot;</span></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor">#include &quot;../common/support.h&quot;</span></div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacegrppi.html">grppi</a> {</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> Identity, <span class="keyword">typename</span> Combiner, <span class="keyword">typename</span> Consumer, <span class="keyword">typename</span> Generator&gt;</div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="namespacegrppi.html#ac2a7bcd673723813fdad9c8f0b8729f3">   30</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacegrppi.html#ac2a7bcd673723813fdad9c8f0b8729f3">stream_reduce_multi_impl</a>(<a class="code" href="classgrppi_1_1polymorphic__execution.html">polymorphic_execution</a> &amp; ex, <span class="keywordtype">int</span> window_size, <span class="keywordtype">int</span> offset, </div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;                              Identity identity, Generator &amp;&amp; generate_op, </div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;                              Combiner &amp;&amp; combine_op, Consumer &amp;&amp; consume_op)</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;{</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;}</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> E, <span class="keyword">typename</span> ... O, <span class="keyword">typename</span> Identity, </div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;          <span class="keyword">typename</span> Generator, <span class="keyword">typename</span> Combiner, <span class="keyword">typename</span> Consumer,</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;          <a class="code" href="namespacegrppi_1_1internal.html#ae5df5ff464a3d9170b5afab9eb247fc3">internal::requires_execution_not_supported&lt;E&gt;</a> = 0&gt;</div><div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="namespacegrppi.html#a218d5b3dcad7d711548dfb53be22717f">   39</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacegrppi.html#ac2a7bcd673723813fdad9c8f0b8729f3">stream_reduce_multi_impl</a>(<a class="code" href="classgrppi_1_1polymorphic__execution.html">polymorphic_execution</a> &amp; ex, <span class="keywordtype">int</span> windowsize, <span class="keywordtype">int</span> offset, </div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;                              Identity identity, Generator &amp;&amp; gen, </div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;                              Combiner &amp;&amp; comb, Consumer &amp;&amp; cons) </div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;{</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;  <a class="code" href="namespacegrppi.html#ac2a7bcd673723813fdad9c8f0b8729f3">stream_reduce_multi_impl</a>&lt;O...&gt;(ex, </div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;    windowsize, offset, identity,</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    std::forward&lt;Generator&gt;(gen), </div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    std::forward&lt;Combiner&gt;(comb), </div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    std::forward&lt;Consumer&gt;(cons)</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;  );</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;}</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> E, <span class="keyword">typename</span> ... O, <span class="keyword">typename</span> Identity, </div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;          <span class="keyword">typename</span> Generator, <span class="keyword">typename</span> Combiner, <span class="keyword">typename</span> Consumer,</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;          <a class="code" href="namespacegrppi_1_1internal.html#aaf7be6a506b2ae087648cc2c586eba1f">internal::requires_execution_supported&lt;E&gt;</a> = 0&gt;</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacegrppi.html#ac2a7bcd673723813fdad9c8f0b8729f3">stream_reduce_multi_impl</a>(<a class="code" href="classgrppi_1_1polymorphic__execution.html">polymorphic_execution</a> &amp; ex, <span class="keywordtype">int</span> windowsize, <span class="keywordtype">int</span> offset,</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;                              Identity identity, Generator &amp;&amp; gen, </div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;                              Combiner &amp;&amp; comb, Consumer &amp;&amp; cons) </div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;{</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;  <span class="keywordflow">if</span> (<span class="keyword">typeid</span>(E) == ex.<a class="code" href="classgrppi_1_1polymorphic__execution.html#a9f13a825bf6b899fabd7b7e008bb7c15">type</a>()) {</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;    <a class="code" href="group__stream__reduce__pattern__native.html#ga7f3df86a6089c3420459bc93a2b7f012">stream_reduce</a>(*ex.<a class="code" href="classgrppi_1_1polymorphic__execution.html#a3e71cdfa3ce06213b8526ad690282a12">execution_ptr</a>&lt;E&gt;(), </div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;      windowsize, offset, identity,</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;      std::forward&lt;Generator&gt;(gen),</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;      std::forward&lt;Combiner&gt;(comb), </div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;      std::forward&lt;Consumer&gt;(cons)</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    );</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;  }</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;  <span class="keywordflow">else</span> {</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    <a class="code" href="namespacegrppi.html#ac2a7bcd673723813fdad9c8f0b8729f3">stream_reduce_multi_impl</a>&lt;O...&gt;(ex, </div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;      windowsize, offset, identity,</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;      std::forward&lt;Generator&gt;(gen),</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;      std::forward&lt;Combiner&gt;(comb), </div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;      std::forward&lt;Consumer&gt;(cons)</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    );</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;  }</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;}</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> Identity, <span class="keyword">typename</span> Generator, <span class="keyword">typename</span> Combiner, <span class="keyword">typename</span> Consumer&gt;</div><div class="line"><a name="l00100"></a><span class="lineno"><a class="line" href="group__stream__reduce__pattern__poly.html#ga48c99c46a17d24d60bede2046ccd31a5">  100</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__stream__reduce__pattern__native.html#ga7f3df86a6089c3420459bc93a2b7f012">stream_reduce</a>(<a class="code" href="classgrppi_1_1polymorphic__execution.html">polymorphic_execution</a> &amp; ex, </div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;      <span class="keywordtype">int</span> windowsize, <span class="keywordtype">int</span> offset, Identity identity,</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;      Generator &amp;&amp; gen, Combiner &amp;&amp; comb, Consumer &amp;&amp; cons) </div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;{</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;  <a class="code" href="namespacegrppi.html#ac2a7bcd673723813fdad9c8f0b8729f3">stream_reduce_multi_impl</a>&lt;</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    <a class="code" href="classgrppi_1_1sequential__execution.html">sequential_execution</a>,</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;    <a class="code" href="classgrppi_1_1parallel__execution__native.html">parallel_execution_native</a>,</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    <a class="code" href="classgrppi_1_1parallel__execution__omp.html">parallel_execution_omp</a>,</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;    <a class="code" href="classgrppi_1_1parallel__execution__tbb.html">parallel_execution_tbb</a></div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;  &gt;(ex, windowsize, offset, identity,</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;      std::forward&lt;Generator&gt;(gen),</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;      std::forward&lt;Combiner&gt;(comb), </div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;      std::forward&lt;Consumer&gt;(cons)</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;   );</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;}</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;} <span class="comment">// end namespace grppi</span></div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="namespacegrppi_html"><div class="ttname"><a href="namespacegrppi.html">grppi</a></div><div class="ttdef"><b>Definition:</b> callable_traits.h:24</div></div>
<div class="ttc" id="classgrppi_1_1parallel__execution__native_html"><div class="ttname"><a href="classgrppi_1_1parallel__execution__native.html">grppi::parallel_execution_native</a></div><div class="ttdoc">Native parallel execution policy. This policy uses ISO C++ threads as implementation building block a...</div><div class="ttdef"><b>Definition:</b> parallel_execution_native.h:136</div></div>
<div class="ttc" id="classgrppi_1_1polymorphic__execution_html_a9f13a825bf6b899fabd7b7e008bb7c15"><div class="ttname"><a href="classgrppi_1_1polymorphic__execution.html#a9f13a825bf6b899fabd7b7e008bb7c15">grppi::polymorphic_execution::type</a></div><div class="ttdeci">const std::type_info &amp; type() const noexcept</div><div class="ttdef"><b>Definition:</b> polymorphic_execution.h:77</div></div>
<div class="ttc" id="polymorphic__execution_8h_html"><div class="ttname"><a href="polymorphic__execution_8h.html">polymorphic_execution.h</a></div></div>
<div class="ttc" id="namespacegrppi_1_1internal_html_aaf7be6a506b2ae087648cc2c586eba1f"><div class="ttname"><a href="namespacegrppi_1_1internal.html#aaf7be6a506b2ae087648cc2c586eba1f">grppi::internal::requires_execution_supported</a></div><div class="ttdeci">std::enable_if_t&lt; is_supported&lt; E &gt;(), int &gt; requires_execution_supported</div><div class="ttdef"><b>Definition:</b> support.h:32</div></div>
<div class="ttc" id="classgrppi_1_1parallel__execution__omp_html"><div class="ttname"><a href="classgrppi_1_1parallel__execution__omp.html">grppi::parallel_execution_omp</a></div><div class="ttdoc">OpenMP parallel execution policy. </div><div class="ttdef"><b>Definition:</b> parallel_execution_omp.h:40</div></div>
<div class="ttc" id="classgrppi_1_1parallel__execution__tbb_html"><div class="ttname"><a href="classgrppi_1_1parallel__execution__tbb.html">grppi::parallel_execution_tbb</a></div><div class="ttdoc">TBB parallel execution policy. </div><div class="ttdef"><b>Definition:</b> parallel_execution_tbb.h:37</div></div>
<div class="ttc" id="classgrppi_1_1polymorphic__execution_html_a3e71cdfa3ce06213b8526ad690282a12"><div class="ttname"><a href="classgrppi_1_1polymorphic__execution.html#a3e71cdfa3ce06213b8526ad690282a12">grppi::polymorphic_execution::execution_ptr</a></div><div class="ttdeci">E * execution_ptr()</div><div class="ttdoc">Get the execution pointer for a given type. </div><div class="ttdef"><b>Definition:</b> polymorphic_execution.h:91</div></div>
<div class="ttc" id="classgrppi_1_1sequential__execution_html"><div class="ttname"><a href="classgrppi_1_1sequential__execution.html">grppi::sequential_execution</a></div><div class="ttdoc">Sequential execution policy. </div><div class="ttdef"><b>Definition:</b> sequential_execution.h:31</div></div>
<div class="ttc" id="classgrppi_1_1polymorphic__execution_html"><div class="ttname"><a href="classgrppi_1_1polymorphic__execution.html">grppi::polymorphic_execution</a></div><div class="ttdef"><b>Definition:</b> polymorphic_execution.h:63</div></div>
<div class="ttc" id="namespacegrppi_1_1internal_html_ae5df5ff464a3d9170b5afab9eb247fc3"><div class="ttname"><a href="namespacegrppi_1_1internal.html#ae5df5ff464a3d9170b5afab9eb247fc3">grppi::internal::requires_execution_not_supported</a></div><div class="ttdeci">std::enable_if_t&lt;!is_supported&lt; E &gt;(), int &gt; requires_execution_not_supported</div><div class="ttdef"><b>Definition:</b> support.h:36</div></div>
<div class="ttc" id="group__stream__reduce__pattern__native_html_ga7f3df86a6089c3420459bc93a2b7f012"><div class="ttname"><a href="group__stream__reduce__pattern__native.html#ga7f3df86a6089c3420459bc93a2b7f012">grppi::stream_reduce</a></div><div class="ttdeci">void stream_reduce(parallel_execution_native &amp;ex, int window_size, int offset, Identity identity, Generator &amp;&amp;generate_op, Combiner &amp;&amp;combine_op, Consumer &amp;&amp;consume_op)</div><div class="ttdoc">Invoke Stream reduction pattern on a stream with native parallel execution. </div><div class="ttdef"><b>Definition:</b> native/stream_reduce.h:56</div></div>
<div class="ttc" id="namespacegrppi_html_ac2a7bcd673723813fdad9c8f0b8729f3"><div class="ttname"><a href="namespacegrppi.html#ac2a7bcd673723813fdad9c8f0b8729f3">grppi::stream_reduce_multi_impl</a></div><div class="ttdeci">void stream_reduce_multi_impl(polymorphic_execution &amp;ex, int window_size, int offset, Identity identity, Generator &amp;&amp;generate_op, Combiner &amp;&amp;combine_op, Consumer &amp;&amp;consume_op)</div><div class="ttdef"><b>Definition:</b> poly/stream_reduce.h:30</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
